package com.hcss.common.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

import javax.servlet.Filter;

/**
 * @desc 过滤器配置类
 * @author maxiaoming
 * @date 2018年6月20日 下午4:47:46
 * @company 浙江鸿程计算机系统有限公司 
 */
@Configuration
public class FilterConfig {
	/**
     * 配置过滤器
     * @return
     */
    @Bean
    public FilterRegistrationBean xssfilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(getXSSFilter());
        registration.addUrlPatterns("/*");
        registration.setName("sessionFilter");
        registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return registration;
    }
    
    @Bean
    public Filter getXSSFilter(){
    	Filter filter = new XSSFilter();
    	return filter;
    }
    
}
